/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.gar.be;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author Programador
 */
@Entity
@Table(name = "GAR_AGRICOLA")
@NamedQueries({@NamedQuery(name = "Agricola.findAll", query = "SELECT a FROM Agricola a"), @NamedQuery(name = "Agricola.findByIdAgricola", query = "SELECT a FROM Agricola a WHERE a.idAgricola = :idAgricola"), @NamedQuery(name = "Agricola.findByCatastro", query = "SELECT a FROM Agricola a WHERE a.catastro = :catastro"), @NamedQuery(name = "Agricola.findByParcela", query = "SELECT a FROM Agricola a WHERE a.parcela = :parcela"), @NamedQuery(name = "Agricola.findByNombrefundo", query = "SELECT a FROM Agricola a WHERE a.nombrefundo = :nombrefundo"), @NamedQuery(name = "Agricola.findBySaldo", query = "SELECT a FROM Agricola a WHERE a.saldo = :saldo"), @NamedQuery(name = "Agricola.findByAsociada", query = "SELECT a FROM Agricola a WHERE a.asociada = :asociada")})
public class Agricola implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_AGRICOLA", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long idAgricola;
    @Column(name = "CATASTRO", length = 20)
    private String catastro;
    @Column(name = "PARCELA", length = 20)
    private String parcela;
    @Column(name = "NOMBREFUNDO", length = 75)
    private String nombrefundo;
    @Column(name = "SALDO", precision = 10, scale = 2)
    private BigDecimal saldo;
    @Column(name = "ASOCIADA")
    private Boolean asociada;

//    @ManyToOne
//    @JoinColumn(name="FID_GARPRENDARIA")
//    private GarantiaPrendaria garantiaPrendaria;

    //    @JoinColumn(name = "ID_AGRICOLA", referencedColumnName = "ID_PRENDARIA", nullable = false, insertable = false, updatable = false)
    //    @OneToOne(optional = false, fetch = FetchType.LAZY)
    //    private GarantiaPrendaria garantiaPrendaria;

    public Agricola() {
    }

    public Agricola(Long idAgricola) {
        this.idAgricola = idAgricola;
    }

//    public GarantiaPrendaria getGarantiaPrendaria() {
//        return garantiaPrendaria;
//    }
//
//    public void setGarantiaPrendaria(GarantiaPrendaria garantiaPrendaria) {
//        this.garantiaPrendaria = garantiaPrendaria;
//    }

    public Long getIdAgricola() {
        return idAgricola;
    }

    public void setIdAgricola(Long idAgricola) {
        this.idAgricola = idAgricola;
    }

    public String getCatastro() {
        return catastro;
    }

    public void setCatastro(String catastro) {
        this.catastro = catastro;
    }

    public String getParcela() {
        return parcela;
    }

    public void setParcela(String parcela) {
        this.parcela = parcela;
    }

    public String getNombrefundo() {
        return nombrefundo;
    }

    public void setNombrefundo(String nombrefundo) {
        this.nombrefundo = nombrefundo;
    }

    public BigDecimal getSaldo() {
        return saldo;
    }

    public void setSaldo(BigDecimal saldo) {
        this.saldo = saldo;
    }

    public Boolean getAsociada() {
        return asociada;
    }

    public void setAsociada(Boolean asociada) {
        this.asociada = asociada;
    }

//    public GarantiaPrendaria getGarantiaPrendaria() {
//        return garantiaPrendaria;
//    }
//
//    public void setGarantiaPrendaria(GarantiaPrendaria garantiaPrendaria) {
//        this.garantiaPrendaria = garantiaPrendaria;
//    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAgricola != null ? idAgricola.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Agricola)) {
            return false;
        }
        Agricola other = (Agricola) object;
        if ((this.idAgricola == null && other.idAgricola != null) || (this.idAgricola != null && !this.idAgricola.equals(other.idAgricola))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.gar.be.Agricola[idAgricola=" + idAgricola + "]";
    }

}
